import { director} from 'cc';

export const HttpConfig = {
  baseURL: 'https://cocostest.jvlihd.cn/index.php',
  // baseURL: 'http://127.0.0.1:8000',
  headers: {
    "server": "true",
    // "ba-user-token": "f701771c-7ee5-4006-83bf-b81164301ed9"
  },
  loginUrl: '/api/user/login',
  refreshTokenUrl: '/api/user/refreshToken',
  redirectToLogin: () => {
    director.loadScene('login');

  },

  setHeader(key: string, value: string) {
    this.headers[key] = value;
  },

  removeHeader(key: string) {
    delete this.headers[key];
  },

  setBaseURL(url: string) {
    this.baseURL = url;
  },

  setRedirect(fn: () => void) {
    this.redirectToLogin = fn;
  }
};
